package com.film.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.film.domain.Director;
import com.film.service.DirectorService;
import com.film.service.impl.DirectorServiceImpl;

@WebServlet("/filmDirector.do")
public class DirectorController extends HttpServlet{
	private DirectorService directorService = new DirectorServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String ids = request.getParameter("dirId");
		int dirId = Integer.parseInt(ids);
		//找到当前的导演得信息
		Director director = directorService.returnDirectorAndFilm(dirId);
		//查询所有的导演信息
		List<Director> directors = directorService.selectAllDirector();
		request.setAttribute("directors", directors);
		request.setAttribute("directorOneInf",director);
		request.getRequestDispatcher("filmDirector.jsp").forward(request, response);
	}
}
